
def findUnique():
    """ using introspection find unique methods for individual data types
    """
    X1 = [1, 2]     # list
    X2 = 2          # number
    X3 = 'dasda'    # string
    X4 = {'a': 1}   # dictionary
    X5 = ('a', 1)   # set

    res = {}
    for x in dir(X1):
        if res.has_key(x): res[x].append('LST')
        else: res[x] = ['LST']
    for x in dir(X2):
        if res.has_key(x): res[x].append('NUM')
        else: res[x] = ['NUM']
    for x in dir(X3):
        if res.has_key(x): res[x].append('STR')
        else: res[x] = ['STR']
    for x in dir(X4):
        if res.has_key(x): res[x].append('DIC')
        else: res[x] = ['DIC']
    for x in dir(X5):
        if res.has_key(x): res[x].append('SET')
        else: res[x] = ['SET']

    for k in sorted(res.keys()):
        if len(res[k]) == 1:
            print k, res[k]

#findUnique()
'''
__abs__ ['NUM'] __and__ ['NUM'] __coerce__ ['NUM'] __delslice__ ['LST'] __div__ ['NUM'] __divmod__ ['NUM']
__float__ ['NUM'] __floordiv__ ['NUM'] __hex__ ['NUM'] __iadd__ ['LST'] __imul__ ['LST'] __int__ ['NUM']
__invert__ ['NUM'] __long__ ['NUM'] __lshift__ ['NUM'] __neg__ ['NUM'] __nonzero__ ['NUM'] __oct__ ['NUM']
__or__ ['NUM'] __pos__ ['NUM'] __pow__ ['NUM'] __radd__ ['NUM'] __rand__ ['NUM'] __rdiv__ ['NUM']
__rdivmod__ ['NUM'] __reversed__ ['LST'] __rfloordiv__ ['NUM'] __rlshift__ ['NUM'] __ror__ ['NUM']
__rpow__ ['NUM'] __rrshift__ ['NUM'] __rshift__ ['NUM'] __rsub__ ['NUM'] __rtruediv__ ['NUM']
__rxor__ ['NUM'] __setslice__ ['LST'] __sub__ ['NUM'] __truediv__ ['NUM'] __xor__ ['NUM'] append ['LST']
capitalize ['STR'] center ['STR'] clear ['DIC'] copy ['DIC'] decode ['STR'] encode ['STR'] endswith ['STR']
expandtabs ['STR'] extend ['LST'] find ['STR'] fromkeys ['DIC'] get ['DIC'] has_key ['DIC'] insert ['LST']
isalnum ['STR'] isalpha ['STR'] isdigit ['STR'] islower ['STR'] isspace ['STR'] istitle ['STR']
isupper ['STR'] items ['DIC'] iteritems ['DIC'] iterkeys ['DIC'] itervalues ['DIC'] join ['STR']
keys ['DIC'] ljust ['STR'] lower ['STR'] lstrip ['STR'] popitem ['DIC'] remove ['LST']
replace ['STR'] reverse ['LST'] rfind ['STR'] rindex ['STR'] rjust ['STR'] rsplit ['STR']
rstrip ['STR'] setdefault ['DIC'] sort ['LST'] split ['STR'] splitlines ['STR'] startswith ['STR']
strip ['STR'] swapcase ['STR'] title ['STR'] translate ['STR'] update ['DIC'] upper ['STR'] values ['DIC']
zfill ['STR']
'''

def ddt(x):
    """ detect data type """
    if '__delslice__' in dir(x): return 'LST'
    # dir(SET) is subset of dir(LST) therefore we diff by length
    if '__getslice__' in dir(x) and len(dir(x)) == 27: return 'SET'
    if '__abs__' in dir(x): return 'NUM'
    if 'strip' in dir(x): return 'STR'
    if 'keys' in dir(x): return 'DIC'

if __name__ == "__main__":
    """ """
    X = [[1, 2], 2, 'abc', {'a': 1}, ('a','b')]
    for x in X:
        print x, ddt(x), x.__class__
